using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Fungus;
using UnityEngine.SceneManagement;

public class 对话系统2 : MonoBehaviour
{
    public string Chatname;
    public GameObject tips;
    public bool cantalk = false;
    public bool 去迷宫;
    // Start is called before the first frame update
   
    private void OnTriggerStay(Collider other)
    {
        Cursor.lockState = CursorLockMode.Confined;
        Flowchart flowchart2 = GameObject.Find("Flowchart2").GetComponent<Flowchart>();
        tips.SetActive(true);
        cantalk = true;

        if (cantalk == true)
        {
            if (Input.GetKeyDown(KeyCode.F))
            {
                flowchart2.ExecuteBlock(Chatname);
                
            }
        }
        
        去迷宫 = flowchart2.GetBooleanVariable("去迷宫");
        if (去迷宫 == true)
        {
            Invoke("切换场景去迷宫",2f);
        }

    }
    private void OnTriggerExit(Collider other)
    {
        tips.SetActive(false);
        cantalk = false;
        Cursor.lockState = CursorLockMode.Locked;
    }
    void 切换场景去迷宫()
    {


        SceneManager.LoadScene("迷宫");
    }
}

